package com.heima.user.controller.v1;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.user.dtos.AuthDto;
import com.heima.user.service.ApUserRealNameService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/api/v1/auth")
public class ApUserRealNameController {

    @Autowired
    ApUserRealNameService realNameService;

    /**
     * 分页条件查询用户认证审核列表
     * @param dto
     * @return
     */
    @PostMapping("/list")
    public ResponseResult pageList(@RequestBody AuthDto dto){
        return realNameService.pageList(dto);
    }

    /**
     * 审核用户认证
     * @param dto
     * @return
     */
    @PostMapping({"/authFail","/authPass"})
    public ResponseResult auth(@RequestBody AuthDto dto, HttpServletRequest request){
        String uri = request.getRequestURI();
        return realNameService.auth(dto,uri);
    }

}
